import AITalk from './talkTemplate';
export const getNextStep = (id, previousTalk, node) => {
	const chagedNextSteps = [];

	if (id === AITalk.TalkEnum.FACE_COMPARE) {
		chagedNextSteps[0].text = '通过';
		chagedNextSteps[1].text = '不通过';
		chagedNextSteps[2].text = '检测不到人';
	}

	if (id === AITalk.TalkEnum.MESSAGE_SURE) {
		let nextStepYes = previousTalk.answer[0].after.id || null;
		let nextStepNo = previousTalk.answer[1].after.id || null;
		let nextStepOther = previousTalk.errorRemind.after.id || null;
		let nextStepnoAnswer = previousTalk.emptyErrorRemind.do.id || null;
		if (nextStepYes !== node.nextStepYes) {
			chagedNextSteps.push({
				text: '肯定回答',
				type: 'yes',
				previous: nextStepYes,
				current: node.nextStepYes
			});
		}
		if (nextStepNo !== node.nextStepNo) {
			chagedNextSteps.push({
				text: '否定回答',
				type: 'no',
				previous: nextStepNo,
				current: node.nextStepNo
			});
		}
		if (nextStepOther !== node.nextStepOther) {
			chagedNextSteps.push({
				text: '其他回答',
				type: 'other',
				previous: nextStepOther,
				current: node.nextStepOther
			});
		}
		if (nextStepnoAnswer !== node.nextStepNoAnswer) {
			chagedNextSteps.push({
				text: '不回答',
				type: 'noAnswers',
				previous: nextStepnoAnswer,
				current: node.nextStepNoAnswer
			});
		}
	}

	return chagedNextSteps;
};
